package seven.test_7_29;

import java.util.Scanner;

public class TestMain3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int len = str.length();
        int max = 0;
        char c = str.charAt(0);
        for (int i = 0; i < len; i++) {
            if(isHuiwen(i,len,str)) {
                max = Math.max(len - i,max);
            }
        }
        for (int i = len - 1; i >= 0; i++) {
            if(isHuiwen(0,i,str)) {
                max = Math.max(i + 1,max);
            }
        }
        System.out.println(max);
    }
    private static boolean isHuiwen(int left,int right,String str) {
        while (left < right) {
            if(str.charAt(left) != str.charAt(right)) {
                return true;
            }
            left++;
            right--;
        }
        return false;
    }
}
